# -*- coding: utf-8 -*-

################################################################################
## Form generated from reading UI file 'SYSTEM_PYSIDE6_FILE_LOCATOR_2_0HsKKNJ.ui'
##
## Created by: Qt User Interface Compiler version 6.9.1
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################

from PyQt6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
    QMetaObject, QObject, QPoint, QRect,
    QSize, QTime, QUrl, Qt)
from PyQt6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
    QFont, QFontDatabase, QGradient, QIcon,
    QImage, QKeySequence, QLinearGradient, QPainter,
    QPalette, QPixmap, QRadialGradient, QTransform)
from PyQt6.QtWidgets import (QApplication, QComboBox, QDialog, QGroupBox,
    QLabel, QLineEdit, QListView, QPushButton,
    QSizePolicy, QWidget)

class Ui_Dialog(object):
    def setupUi(self, Dialog):
        if not Dialog.objectName():
            Dialog.setObjectName(u"Dialog")
        Dialog.resize(621, 571)
        Dialog.setMinimumSize(QSize(621, 571))
        Dialog.setMaximumSize(QSize(621, 571))
        self.groupBox = QGroupBox(Dialog)
        self.groupBox.setObjectName(u"groupBox")
        self.groupBox.setGeometry(QRect(10, 10, 601, 551))
        self.groupBox.setMinimumSize(QSize(601, 0))
        self.listView = QListView(self.groupBox)
        self.listView.setObjectName(u"listView")
        self.listView.setGeometry(QRect(10, 110, 581, 311))
        self.pushButton_1 = QPushButton(self.groupBox)
        self.pushButton_1.setObjectName(u"pushButton_1")
        self.pushButton_1.setGeometry(QRect(40, 30, 91, 31))
        self.pushButton_2 = QPushButton(self.groupBox)
        self.pushButton_2.setObjectName(u"pushButton_2")
        self.pushButton_2.setGeometry(QRect(140, 30, 91, 31))
        self.lineEdit_1 = QLineEdit(self.groupBox)
        self.lineEdit_1.setObjectName(u"lineEdit_1")
        self.lineEdit_1.setGeometry(QRect(70, 430, 521, 31))
        self.label_1 = QLabel(self.groupBox)
        self.label_1.setObjectName(u"label_1")
        self.label_1.setGeometry(QRect(10, 430, 51, 31))
        self.label_1.setAlignment(Qt.AlignmentFlag.AlignCenter)
        self.label_2 = QLabel(self.groupBox)
        self.label_2.setObjectName(u"label_2")
        self.label_2.setGeometry(QRect(10, 470, 51, 31))
        self.label_2.setAlignment(Qt.AlignmentFlag.AlignCenter)
        self.comboBox_1 = QComboBox(self.groupBox)
        self.comboBox_1.addItem("")
        self.comboBox_1.setObjectName(u"comboBox_1")
        self.comboBox_1.setGeometry(QRect(70, 470, 521, 31))
        self.lineEdit_2 = QLineEdit(self.groupBox)
        self.lineEdit_2.setObjectName(u"lineEdit_2")
        self.lineEdit_2.setGeometry(QRect(130, 70, 331, 31))
        self.label_3 = QLabel(self.groupBox)
        self.label_3.setObjectName(u"label_3")
        self.label_3.setGeometry(QRect(10, 70, 53, 31))
        self.label_3.setAlignment(Qt.AlignmentFlag.AlignCenter)
        self.pushButton_4 = QPushButton(self.groupBox)
        self.pushButton_4.setObjectName(u"pushButton_4")
        self.pushButton_4.setGeometry(QRect(500, 70, 91, 31))
        self.iconButton_2 = QPushButton(self.groupBox)
        self.iconButton_2.setObjectName(u"iconButton_2")
        self.iconButton_2.setGeometry(QRect(230, 30, 31, 31))
        self.iconButton_1 = QPushButton(self.groupBox)
        self.iconButton_1.setObjectName(u"iconButton_1")
        self.iconButton_1.setGeometry(QRect(10, 30, 31, 31))
        self.iconButton_3 = QPushButton(self.groupBox)
        self.iconButton_3.setObjectName(u"iconButton_3")
        self.iconButton_3.setGeometry(QRect(470, 70, 31, 31))
        self.pushButton_5 = QPushButton(self.groupBox)
        self.pushButton_5.setObjectName(u"pushButton_5")
        self.pushButton_5.setGeometry(QRect(500, 510, 91, 31))
        self.comboBox_2 = QComboBox(self.groupBox)
        self.comboBox_2.setObjectName(u"comboBox_2")
        self.comboBox_2.setGeometry(QRect(70, 70, 51, 31))
        self.pushButton_3 = QPushButton(self.groupBox)
        self.pushButton_3.setObjectName(u"pushButton_3")
        self.pushButton_3.setGeometry(QRect(400, 510, 91, 31))

        self.retranslateUi(Dialog)

        QMetaObject.connectSlotsByName(Dialog)
    # setupUi

    def retranslateUi(self, Dialog):
        Dialog.setWindowTitle(QCoreApplication.translate("Dialog", u"Dialog", None))
        self.groupBox.setTitle(QCoreApplication.translate("Dialog", u"GroupBox", None))
        self.pushButton_1.setText(QCoreApplication.translate("Dialog", u"Backward", None))
        self.pushButton_2.setText(QCoreApplication.translate("Dialog", u"Forward", None))
        self.label_1.setText(QCoreApplication.translate("Dialog", u"\u6587\u4ef6\u540d", None))
        self.label_2.setText(QCoreApplication.translate("Dialog", u"\u6269\u5c55\u540d", None))
        self.comboBox_1.setItemText(0, QCoreApplication.translate("Dialog", u".xlsx (Microsoft Office Excel 2007-2010)", None))

        self.label_3.setText(QCoreApplication.translate("Dialog", u"OSPath", None))
        self.pushButton_4.setText(QCoreApplication.translate("Dialog", u"\u8f6c\u5230", None))
        self.iconButton_2.setText("")
        self.iconButton_1.setText("")
        self.iconButton_3.setText("")
        self.pushButton_5.setText(QCoreApplication.translate("Dialog", u"Confirm", None))
        self.pushButton_3.setText(QCoreApplication.translate("Dialog", u"Select", None))
    # retranslateUi

# #################################################
# 集成 PyQt / PySide 的 QRC 编译后的文件代码 (可选)
# #################################################

# Resource object code (Python 3)
# Created by: object code
# Created by: The Resource Compiler for Qt version 6.9.1
# WARNING! All changes made in this file will be lost!

from PyQt6 import QtCore

qt_resource_data = b"\
\x00\x00\x01\xa5\
<\
svg xmlns=\x22http:\
//www.w3.org/200\
0/svg\x22 class=\x22ic\
on icon-tabler i\
con-tabler-arrow\
-right\x22 width=\x222\
4\x22 height=\x2224\x22 v\
iewBox=\x220 0 24 2\
4\x22 stroke-width=\
\x222\x22 stroke=\x22curr\
entColor\x22 fill=\x22\
none\x22 stroke-lin\
ecap=\x22round\x22 str\
oke-linejoin=\x22ro\
und\x22>\x0a  <path st\
roke=\x22none\x22 d=\x22M\
0 0h24v24H0z\x22 fi\
ll=\x22none\x22/>\x0a  <l\
ine x1=\x225\x22 y1=\x221\
2\x22 x2=\x2219\x22 y2=\x221\
2\x22 />\x0a  <line x1\
=\x2213\x22 y1=\x2218\x22 x2\
=\x2219\x22 y2=\x2212\x22 />\
\x0a  <line x1=\x2213\x22\
 y1=\x226\x22 x2=\x2219\x22 \
y2=\x2212\x22 />\x0a</svg\
>\x0a\x0a\x0a\
\x00\x00\x01\x83\
<\
svg xmlns=\x22http:\
//www.w3.org/200\
0/svg\x22 class=\x22ic\
on icon-tabler i\
con-tabler-folde\
r\x22 width=\x2224\x22 he\
ight=\x2224\x22 viewBo\
x=\x220 0 24 24\x22 st\
roke-width=\x222\x22 s\
troke=\x22currentCo\
lor\x22 fill=\x22none\x22\
 stroke-linecap=\
\x22round\x22 stroke-l\
inejoin=\x22round\x22>\
\x0a  <path stroke=\
\x22none\x22 d=\x22M0 0h2\
4v24H0z\x22 fill=\x22n\
one\x22/>\x0a  <path d\
=\x22M5 4h4l3 3h7a2\
 2 0 0 1 2 2v8a2\
 2 0 0 1 -2 2h-1\
4a2 2 0 0 1 -2 -\
2v-11a2 2 0 0 1 \
2 -2\x22 />\x0a</svg>\x0a\
\x0a\x0a\
\x00\x00\x01\x9c\
<\
svg xmlns=\x22http:\
//www.w3.org/200\
0/svg\x22 class=\x22ic\
on icon-tabler i\
con-tabler-file\x22\
 width=\x2224\x22 heig\
ht=\x2224\x22 viewBox=\
\x220 0 24 24\x22 stro\
ke-width=\x222\x22 str\
oke=\x22currentColo\
r\x22 fill=\x22none\x22 s\
troke-linecap=\x22r\
ound\x22 stroke-lin\
ejoin=\x22round\x22>\x0a \
 <path stroke=\x22n\
one\x22 d=\x22M0 0h24v\
24H0z\x22 fill=\x22non\
e\x22/>\x0a  <path d=\x22\
M14 3v4a1 1 0 0 \
0 1 1h4\x22 />\x0a  <p\
ath d=\x22M17 21h-1\
0a2 2 0 0 1 -2 -\
2v-14a2 2 0 0 1 \
2 -2h7l5 5v11a2 \
2 0 0 1 -2 2z\x22 /\
>\x0a</svg>\x0a\x0a\x0a\
\x00\x00\x01\xa2\
<\
svg xmlns=\x22http:\
//www.w3.org/200\
0/svg\x22 class=\x22ic\
on icon-tabler i\
con-tabler-arrow\
-left\x22 width=\x2224\
\x22 height=\x2224\x22 vi\
ewBox=\x220 0 24 24\
\x22 stroke-width=\x22\
2\x22 stroke=\x22curre\
ntColor\x22 fill=\x22n\
one\x22 stroke-line\
cap=\x22round\x22 stro\
ke-linejoin=\x22rou\
nd\x22>\x0a  <path str\
oke=\x22none\x22 d=\x22M0\
 0h24v24H0z\x22 fil\
l=\x22none\x22/>\x0a  <li\
ne x1=\x225\x22 y1=\x2212\
\x22 x2=\x2219\x22 y2=\x2212\
\x22 />\x0a  <line x1=\
\x225\x22 y1=\x2212\x22 x2=\x22\
11\x22 y2=\x2218\x22 />\x0a \
 <line x1=\x225\x22 y1\
=\x2212\x22 x2=\x2211\x22 y2\
=\x226\x22 />\x0a</svg>\x0a\x0a\
\x0a\
\x00\x00\x01U\
<\
svg xmlns=\x22http:\
//www.w3.org/200\
0/svg\x22 class=\x22ic\
on icon-tabler i\
con-tabler-rotat\
e\x22 width=\x2224\x22 he\
ight=\x2224\x22 viewBo\
x=\x220 0 24 24\x22 st\
roke-width=\x222\x22 s\
troke=\x22currentCo\
lor\x22 fill=\x22none\x22\
 stroke-linecap=\
\x22round\x22 stroke-l\
inejoin=\x22round\x22>\
\x0a  <path stroke=\
\x22none\x22 d=\x22M0 0h2\
4v24H0z\x22 fill=\x22n\
one\x22/>\x0a  <path d\
=\x22M19.95 11a8 8 \
0 1 0 -.5 4m.5 5\
v-5h-5\x22 />\x0a</svg\
>\x0a\x0a\x0a\
"

qt_resource_name = b"\
\x00\x14\
\x06\xaf\x1e\x87\
\x00i\
\x00c\x00o\x00n\x00-\x00a\x00r\x00r\x00o\x00w\x00-\x00r\x00i\x00g\x00h\x00t\x00.\
\x00s\x00v\x00g\
\x00\x0f\
\x06\xe3@\x07\
\x00i\
\x00c\x00o\x00n\x00-\x00f\x00o\x00l\x00d\x00e\x00r\x00.\x00s\x00v\x00g\
\x00\x0d\
\x03l|\xe7\
\x00i\
\x00c\x00o\x00n\x00-\x00f\x00i\x00l\x00e\x00.\x00s\x00v\x00g\
\x00\x13\
\x06b\xd7\xc7\
\x00i\
\x00c\x00o\x00n\x00-\x00a\x00r\x00r\x00o\x00w\x00-\x00l\x00e\x00f\x00t\x00.\x00s\
\x00v\x00g\
\x00 \
\x0d\xa2{g\
\x00i\
\x00c\x00o\x00n\x00-\x00r\x00o\x00t\x00a\x00t\x00e\x00-\x00c\x00o\x00u\x00n\x00t\
\x00e\x00r\x00c\x00l\x00o\x00c\x00k\x00w\x00i\x00s\x00e\x00.\x00s\x00v\x00g\
"

qt_resource_struct = b"\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x05\x00\x00\x00\x01\
\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00R\x00\x00\x00\x00\x00\x01\x00\x00\x030\
\x00\x00\x01\x98\xe5\x05\x04@\
\x00\x00\x00r\x00\x00\x00\x00\x00\x01\x00\x00\x04\xd0\
\x00\x00\x01\x98\xe0oWP\
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
\x00\x00\x01\x98\xe0o\xb5\x10\
\x00\x00\x00.\x00\x00\x00\x00\x00\x01\x00\x00\x01\xa9\
\x00\x00\x01\x98\xe5\x04\xf4\xa0\
\x00\x00\x00\x9e\x00\x00\x00\x00\x00\x01\x00\x00\x06v\
\x00\x00\x01\x98\xe0p\x030\
"

def qInitResources():
    QtCore.qRegisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data)

def qCleanupResources():
    QtCore.qUnregisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data)

qInitResources()

# #############################################################################################
# 新增 PyQt / PySide 对话框类 Class (继承自 QDialog) 以使用 Qt Designer / PySide 生成的 UI 代码
# #############################################################################################

import os
import sys
# ..................................................
WORKNG_PATH = sys.argv[1] if (len(sys.argv) >= 2) else os.getcwd()
# ..................................................
from PyQt6.QtCore import Qt
from PyQt6.QtCore import QStringListModel    # 用于生成文本形式列表
from PyQt6.QtGui  import QStandardItemModel  # 用于生成标准形式列表
from PyQt6.QtGui  import QStandardItem, QIcon, QPixmap  # 用于对标准形式列表项配置细节
# ..................................................
from GF_PY3_CLASS_Python_3_OSPath_Operate import Python_3_OSPath_Operate

class Dialog_System_File_Locator(QDialog):

    # PyQt / PySide 对话框类 Class (继承自 QDialog)

    def __init__(self, parent = None):

        super().__init__(parent)
        self.ui = Ui_Dialog()
        self.ui.setupUi(self)

        # 设置 QListView 选择模式
        self.ui.listView.setSelectionMode(QListView.SelectionMode.SingleSelection)    # 单选
    #   self.ui.listView.setSelectionMode(QListView.SelectionMode.MultiSelection)     # 多选
    #   self.ui.listView.setSelectionMode(QListView.SelectionMode.ExtendedSelection)  # 扩展选择

        # 设置 Icon 图标
        self.ui.iconButton_1.setIcon(QIcon(":/icon-arrow-left.svg"))
        self.ui.iconButton_2.setIcon(QIcon(":/icon-arrow-right.svg"))
        self.ui.iconButton_3.setIcon(QIcon(":/icon-rotate-counterclockwise.svg"))
    #   self.ui.iconButton_3.setIcon(QIcon())      # 清除 Icon (方法 1)
    #   self.ui.iconButton_3.setIcon(QIcon(None))  # 清除 Icon (方法 2)

        # 为 comboBox_2 添加选项 (盘符)
        if (os.path.exists("A:") == True): self.ui.comboBox_2.addItem("A:\\")
        if (os.path.exists("B:") == True): self.ui.comboBox_2.addItem("B:\\")
        if (os.path.exists("C:") == True): self.ui.comboBox_2.addItem("C:\\")
        if (os.path.exists("D:") == True): self.ui.comboBox_2.addItem("D:\\")
        if (os.path.exists("E:") == True): self.ui.comboBox_2.addItem("E:\\")
        if (os.path.exists("F:") == True): self.ui.comboBox_2.addItem("F:\\")
        if (os.path.exists("G:") == True): self.ui.comboBox_2.addItem("G:\\")
        if (os.path.exists("H:") == True): self.ui.comboBox_2.addItem("H:\\")

        self.PUB_Current_Path = WORKNG_PATH
        self.PUB_Model_for_QListView = None
        # ..........................................
        self.for_QListView_setModel(Current_Path = self.PUB_Current_Path)
        # ..........................................
        self.PUB_Located_Part      = "unknown"
        self.PUB_Located_Dir       = "unknown"
        self.PUB_Inputed_File_Name = "unknown"
        self.PUB_Changed_File_Ext  = "unknown"
        self.PUB_Compose_Full_Path = "unknown"  # Use on Output to System Standard Out

        # 连接信号和槽
        self.setup_connections()

    def setup_connections(self):

        """ 连接所有信号和槽 """

        # 连接按钮
        self.ui.listView.doubleClicked.connect(self.for_QListView_item_doubleClicked)
        self.ui.pushButton_1.clicked.connect(self.DIY_on_pushButton_1_clicked)  # "向后 (Backward)" 按键
        self.ui.iconButton_1.clicked.connect(self.DIY_on_pushButton_1_clicked)  # "向后 (Backward)" 图标
        self.ui.pushButton_2.clicked.connect(self.DIY_on_pushButton_2_clicked)  # "向前 (Forward)" 按键
        self.ui.iconButton_2.clicked.connect(self.DIY_on_pushButton_2_clicked)  # "向前 (Forward)" 图标
        self.ui.pushButton_4.clicked.connect(self.DIY_on_pushButton_4_clicked)  # "转到 (Go to)" 按键
        self.ui.iconButton_3.clicked.connect(self.DIY_on_pushButton_4_clicked)  # "转到 (Go to)" 图标
        self.ui.pushButton_3.clicked.connect(self.DIY_on_pushButton_3_clicked)  # "选择 (Select)" 按键
        self.ui.pushButton_5.clicked.connect(self.DIY_on_pushButton_5_clicked)  # "确认 (Confirm)" 按键

    def keyPressEvent(self, event):

        """ 处理键盘按下事件 """

        key      = event.key()
        modifier = event.modifiers() # 判断修饰键
        # ..........................................
        # 处理特定按键
        if (key == Qt.Key.Key_Escape   ): self.close()  # 关闭窗口 (Esc)
        if (key == Qt.Key.Key_Backspace): self.DIY_on_pushButton_1_clicked()
        # ..........................................
        # 处理组合按键
        if (modifier == Qt.KeyboardModifier.ControlModifier):
            if (key == Qt.Key.Key_Enter ): self.DIY_on_pushButton_5_clicked()  # Ctrl + Enter
            if (key == Qt.Key.Key_Return): self.DIY_on_pushButton_5_clicked()  # Ctrl + Enter
        # ..........................................
        # 让文本编辑器正常处理文本输入 (其他按键交给父类处理)
        super().keyPressEvent(event)

    def DIY_Get_OSPath_Type(self, OSPath:str) -> str:

        OSPath_Type:str = "null"
        # ..........................................
        if (os.path.isfile(OSPath) == True):
            OSPath_Type = "file"
        # ..........................................
        if (os.path.isdir(OSPath) == True):
            OSPath_Type = "directory"
        # ..........................................
        return OSPath_Type

    def for_QListView_setModel(self, Current_Path:str = "./") -> int:

        OSPath = Python_3_OSPath_Operate()
        # ..........................................
        # 将 "相对路径" 转换为 "绝对路径" (要求起始路径必须明确, 如 D: 或 /home)
        Updated_Current_Path = os.path.normpath(Current_Path)

    #   # --------------------------------------
    #   # 使用 QStringListModel 创建文本形式列表
    #   # --------------------------------------
    #
    #   Model = QStringListModel()  # 创建 QStringListModel
    #
    #   # 将 Python 字符串列表转换为 Qt 可接受的格式
    #   # 在 PySide6 中, 可以直接传递 Python 列表
    #   Model.setStringList(["example", "example.csv", ...])

        # ----------------------------------------
        # 使用 QStandardItemModel 创建标准形式列表
        # ----------------------------------------

        Model = QStandardItemModel()  # 创建 QStandardItemModel

    #   Model.clear()  # 清空当前模型

        # 为 "当前路径 (Path) 的子项 (Sub-Item)" 配置细节
        for Sub_Item in os.listdir(Updated_Current_Path):
            Full_Path:str      = os.path.join(Updated_Current_Path, Sub_Item)
            Full_Path_Type:str = self.DIY_Get_OSPath_Type(OSPath = Full_Path)
            # ......................................
            if (Full_Path_Type == "directory"):
                Item = QStandardItem(QIcon(":/icon-folder.svg"), Sub_Item)  # 配置文件夹图标
                Item.setToolTip(f"目录: {Sub_Item}")  # 配置工具提示
                Model.appendRow(Item)
            # ......................................
            if (Full_Path_Type == "file"):
                Item = QStandardItem(QIcon(":/icon-file.svg"), Sub_Item)  # 配置文件图标
                Item.setToolTip(f"文件: {Sub_Item}")  # 配置工具提示
                Model.appendRow(Item)

        # 将模型设置到 ListView
        self.ui.listView.setModel(Model)

        # 将 Path 传递到公共变量, 以便其它函数调用
        self.PUB_Current_Path = Updated_Current_Path
        # 将 Model 传递到公共变量, 以便其它函数调用
        self.PUB_Model_for_QListView = Model

        # -----------------------------------------------------------------------------
        # 如果存在 "地址栏" 则将当前目录地址更新到 "地址栏" (通常位于顶部且名称为 Path)
        # -----------------------------------------------------------------------------

        self.ui.comboBox_2.setCurrentText(OSPath.Get_Partition(OSPath = Updated_Current_Path))
        self.ui.lineEdit_2.setText(OSPath.Get_Directory(OSPath = Updated_Current_Path))

        return 1

    def for_QListView_getSelectedTexts(self):

        LIST_Selected_Indexes:list = self.ui.listView.selectedIndexes()
        # >>> print(LIST_Selected_Indexes)
        # [<PySide6.QtCore.QModelIndex(0,0,0x292ba276430,QStandardItemModel(0x292b8237ed0)) at 0x00000292BA739480>]
        # ..........................................
        # 提取 self.ui.listView.selectedIndexes() 的行号 (整数)
        LIST_Selected_Row_Num:list = [Index.row() for Index in LIST_Selected_Indexes]
        # >>> print(LIST_Selected_Row_Num)
        # [0]
        # ..........................................
        LIST_Selected_Items:list = [self.PUB_Model_for_QListView.item(i) for i in LIST_Selected_Row_Num]
        # >>> Model = QStandardItemModel()
        # >>> Item = QStandardItem(QIcon(None), "example_text")
        # >>> Model.appendRow(Item)
        # >>> print(Model.item(0))
        # <PySide6.QtGui.QStandardItem object at 0x000001DCCC638580>
        LIST_Selected_Texts:list = [Item.text() for Item in LIST_Selected_Items]
        # ..........................................
        return LIST_Selected_Texts

    def for_QListView_item_doubleClicked(self):

        self.DIY_on_pushButton_3_clicked()
        # ..........................................
        return 1

    def DIY_on_pushButton_1_clicked(self) -> int:  # "向后 (Backward)" 按键

        OSPath = Python_3_OSPath_Operate()
        # ..........................................
        Updated_Current_Path = OSPath.Backward(OSPath = self.PUB_Current_Path)
        # ..........................................
        self.for_QListView_setModel(Current_Path = Updated_Current_Path)
        # ..........................................
        return 1

    def DIY_on_pushButton_2_clicked(self):  # "向前 (Forward)" 按键

        LIST_Selected_Texts:list = self.for_QListView_getSelectedTexts()
        # ..........................................
        if (LIST_Selected_Texts != []):
            Selected_Path:str      = self.PUB_Current_Path + os.sep + LIST_Selected_Texts[0]
            Selected_Path_Type:str = self.DIY_Get_OSPath_Type(OSPath = Selected_Path)
            # ......................................
            if (Selected_Path_Type == "directory"):
                self.for_QListView_setModel(Current_Path = Selected_Path)
        # ..........................................
        return 1

    def DIY_on_pushButton_3_clicked(self):  # "选择 (Select)" 按键

        LIST_Selected_Texts:list = self.for_QListView_getSelectedTexts()
        # ..........................................
        if (LIST_Selected_Texts != []):
            Selected_Path:str      = self.PUB_Current_Path + os.sep + LIST_Selected_Texts[0]
            Selected_Path_Type:str = self.DIY_Get_OSPath_Type(OSPath = Selected_Path)
            # ......................................
            if (Selected_Path_Type == "directory"):
                self.for_QListView_setModel(Current_Path = Selected_Path)
            # ......................................
            if (Selected_Path_Type == "file"):
                self.ui.lineEdit_1.setText(LIST_Selected_Texts[0])
        # ..........................................
        return 1

    def DIY_on_pushButton_4_clicked(self) -> int:  # "转到 (Go to)" 按键

        OSPath = Python_3_OSPath_Operate()
        # ..........................................
        Updated_Current_Path = OSPath.Combining_Partition_and_Directory(Partition = self.ui.comboBox_2.currentText(), Directory = self.ui.lineEdit_2.text())
        # ..........................................
        self.for_QListView_setModel(Current_Path = Updated_Current_Path)
        # ..........................................
        return 1

    def DIY_on_pushButton_5_clicked(self) -> int:  # "确认 (Confirm)" 按键

        OSPath = Python_3_OSPath_Operate()
        # ..........................................
        self.PUB_Located_Part      = self.ui.comboBox_2.currentText()
        self.PUB_Located_Dir       = self.ui.lineEdit_2.text()
        self.PUB_Inputed_File_Name = self.ui.lineEdit_1.text()
        self.PUB_Changed_File_Ext  = self.ui.comboBox_1.currentText()
        # ..........................................
        self.PUB_Changed_File_Ext  = ".xlsx" if (".xlsx" in self.PUB_Changed_File_Ext[0:5]) else "unknown"
        self.PUB_Compose_Full_Path = OSPath.Combining_Partition_and_Directory(Partition = self.PUB_Located_Part, Directory = self.PUB_Located_Dir) + os.sep + \
                                     self.PUB_Inputed_File_Name + \
                                     self.PUB_Changed_File_Ext
        # ..........................................
    #   self.close()  # 只关闭当前窗口
    #   self.quit()   # 完全退出程序
    #   self.exit()   # 完全退出程序 (返回退出代码)
        # ..........................................
        self.accept() # 关闭对话框并返回结果 (主要用于 QDialog 对话框, 设置对话框结果为 Accepted)
    #   self.reject() # 关闭对话框并返回结果 (主要用于 QDialog 对话框, 设置对话框结果为 Rejected)
        # ..........................................
        # self.accept() / self.reject() 窗口调用示例:
        # >>> new_window = Dialog_File_Browser()
        # >>>
        # >>> window_res = new_window.exec()
        # >>> if (window_res == QDialog.DialogCode.Accepted):
        # ...     print(new_window.Compose_Full_Path)
        # 'C:\Example\Sales.xlsx'
        # >>>
        # >>> # 注意: 用户点击窗口关闭按钮通常也会触发 Rejected
        # >>> # Tips: new_window.exec(): 模态 (Modal) 对话框, 阻塞线程到用户响应后返回 DialogCode
        # >>> # Tips: new_window.show(): 非模态 (Modeless) 窗口, 非阻塞, 执行结束立即关闭 (关闭较快, 用户不易操作, 类似闪退)

        # #############################
        # Output to System Standard Out
        # #############################

        sys.stdout.write(self.PUB_Compose_Full_Path)

        return 1

if __name__ == "__main__":

    app = QApplication(sys.argv)

    # 设置应用程序样式
    app.setStyle('Fusion')

    # 创建并显示对话框
    dialog = Dialog_System_File_Locator()
    dialog.show()

    sys.exit(app.exec())
